import {
	onShow
} from '@dcloudio/uni-app';
import {
	useCartStore
} from '@/store/cart.js';
import { watch } from 'vue';
export const cartMixin = {
	setup() {
		const cartStore = useCartStore();
		onShow(() => {
			setBadge();
		});
		const setBadge = () => {
			uni.setTabBarBadge({
				index: 2, // 索引
				text: cartStore.total + '' // 注意：text 的值必须是字符串，不能是数字
			});
		};
		return {
			cartStore,
			setBadge
		}
	}
}